package com.huangwenshuo.futurestarschoolmanagement.mapper;

import com.huangwenshuo.futurestarschoolmanagement.pojo.dto.UserDto;
import com.huangwenshuo.futurestarschoolmanagement.pojo.po.UsersPo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huangwenshuo.futurestarschoolmanagement.pojo.vo.UserInfoVo;
import com.huangwenshuo.futurestarschoolmanagement.pojo.vo.UsersVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author huangwenshuo
 * @since 2020-12-26
 */
@Mapper
public interface UsersMapper extends BaseMapper<UsersPo> {
    /**
     * 根据用户名查询信息
     * @param username
     * @return
     */
    UsersPo findByUsername(String username);

    /**
     * 通过用户id查询用户信息
     * @param uid
     * @return
     */
    UserInfoVo getUserInfo(Integer uid);

    List<UsersVo> findUsers(@Param("realName") String realName, @Param("phone") String phone);

    void register(@Param("dto") UserDto.RegisterUser registerUser);

    void updateUserInfo(@Param("dto") UserDto.updateUserInfo updateUserInfo);

    Map<String,String> findPwdByUid(@Param("uid") Integer uid);

    void updatePwd(@Param("pwd") String pwd,@Param("uid") Integer uid);

    Map<String, String> findByUid(Integer uid);
}
